package com.ytk.icerain.api.action;

import java.io.PrintWriter;

import com.xunjia.action.XunJiaActionSupport;
import com.xunjia.json.JSONObject;
import com.ytk.icerain.api.dao.KeyswordsDao;

public class keysWordsAction extends XunJiaActionSupport {
	private String keywords;// 關鍵字
	private int size;// 需要廣告條數
	private String type;// 廣告類型

	public String getKeywords() {
		return keywords;
	}

	public void setKeywords(String keywords) {
		this.keywords = keywords;
	}

	public int getSize() {
		return size;
	}

	public void setSize(int size) {
		this.size = size;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Override
	public String execute() throws Exception {
		
		KeyswordsDao p = new KeyswordsDao();
		try{
			PrintWriter out = this.response.getWriter();		
			this.keywords=new String(this.keywords.getBytes("8859_1"),"GBK");
			out.print(p.getKeywords(this.keywords,this.size, this.type));
		}catch(Exception e){
			e.printStackTrace();
		}
		
		return null;
	}

}
